package com.ruicar.afs.cloud.admin.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruicar.afs.cloud.common.core.constant.CommonConstants;
import com.ruicar.afs.cloud.common.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * 菜单/权限
 *
 * @author Fzero
 */
@Data
@TableName("sys_permission")
@ApiModel(value = "菜单权限")
public class SysPermission extends BaseEntity<SysPermission> {

	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "菜单/权限名称")
	private String name;

	@ApiModelProperty(value = "层级")
	private Integer level;

	@ApiModelProperty(value = "类型 0页面 1具体操作")
	private Integer type;

	@ApiModelProperty(value = "菜单标题")
	private String title;

	@ApiModelProperty(value = "权限标记，逗号分隔")
	private String permissions;

	@ApiModelProperty(value = "前端组件")
	private String component;

	@ApiModelProperty(value = "是否为基础组件")
	private String basic;

	@ApiModelProperty(value = "前端路径")
	private String path;

	@ApiModelProperty(value = "图标")
	private String icon;

	@ApiModelProperty(value = "父id")
	@JsonSerialize(using= ToStringSerializer.class)
	@JSONField(serializeUsing = com.alibaba.fastjson.serializer.ToStringSerializer.class)
	private Long parentId;

	@ApiModelProperty(value = "说明备注")
	private String description;

	@ApiModelProperty(value = "排序值")
	private BigDecimal sortOrder;

	@ApiModelProperty(value = "是否启用 1启用 -0禁用")
	private String status = CommonConstants.STATUS_NORMAL;

	@ApiModelProperty(value = "网页链接")
	private String url;

	@TableField(exist = false)
	@ApiModelProperty(value = "子菜单/权限")
	private List<SysPermission> children;

	@TableField(exist = false)
	@ApiModelProperty(value = "页面拥有的权限类型")
	private List<String> permTypes;

	@TableField(exist = false)
	@ApiModelProperty(value = "节点展开 前端所需")
	private Boolean expand = true;

	@TableField(exist = false)
	@ApiModelProperty(value = "是否勾选 前端所需")
	private Boolean checked = false;

	@TableField(exist = false)
	@ApiModelProperty(value = "是否选中 前端所需")
	private Boolean selected = false;


	@ApiModelProperty(value = "租户是否隐藏，0-否，1是")
	private String tenantHideFlag=CommonConstants.STATUS_NORMAL;

	@ApiModelProperty(value = "组件参数")
	private String params;
}
